import React, { Component } from 'react'
import PropTypes from 'prop-types';
import { Items } from '../Items'

export class List extends Component {

    // 对于接受的props 进行限制
	static propTypes = {
        todos: PropTypes.array.isRequired,
        upDateTodo: PropTypes.func.isRequired
	}


    render() {
        const {todos,upDateTodo,deleteTodo} = this.props;
        return (
            <ul className="todo-main">
               {
                   todos.map((todo)=>{
                    return <Items key={todo.id} {...todo} upDateTodo={upDateTodo} deleteTodo={deleteTodo}/>
                   })
               }
            </ul>
        )
    }
}
